package com.mls.fivedistrict.enums;

import com.baomidou.mybatisplus.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author chenhua
 * @date 2018/5/18 17:53
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum GoodsOrderStatusEnum implements IEnum {
    UNPAID("未支付","unpaid"),
    UNSHIPPED("待发货","unshipped"),
    SHIPPED("已发货","shipped"),
    COMPLETED("已完成","completed"),
    EXPIRED("已失效","expired");
    private String desc;
    private String value;
    GoodsOrderStatusEnum(String desc, String value) {
        this.desc = desc;
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @JsonCreator
    public static GoodsOrderStatusEnum getItem(String code){
        for(GoodsOrderStatusEnum item : values()){
            if(item.getValue().equals(code)){
                return item;
            }
        }
        return null;
    }
}
